package com.yong.opengl.ui.draw_bg;

import android.opengl.GLES20;
import android.opengl.GLES30;
import android.opengl.GLSurfaceView;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

/**
 * @version 1.0
 * @Description: 渲染背景的渲染器
 * @Author: yong
 * @time 2021/3/31 0031 10:21
 */
public class DrawBgRender implements GLSurfaceView.Renderer {
    @Override
    public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) {
        //设置背景颜色r,g,b,a(为颜色缓冲区指定清除值)
        GLES30.glClearColor(1,0,0,0);
    }

    @Override
    public void onSurfaceChanged(GL10 gl10, int width, int height) {
        //设置视图窗口
        GLES30.glViewport(0,0,width,height);
    }

    @Override
    public void onDrawFrame(GL10 gl10) {
        //把颜色缓冲区设定为我们预设的颜色
        GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT);
    }
}
